#include <iostream>
#include "globals.hpp"
#include "command.hpp"

struct PrintText : public Command {
	PrintText(const char *t,int p):
		Command(p),text((char*) t) {};

	bool execute() {
		std::cout << text << std::endl;
	}

	char *text;
};

int main()
{
	Globals::logger->setLogFile("log.txt");
	Globals::logger->log("%s","Program initiated");

	try {
		Globals::queue->pushCommand(new PrintText("hello", Command::HALF_PRIORITY));
		Globals::queue->pushCommand(new PrintText("friend", Command::HIGH_PRIORITY));
		Globals::queue->pushCommand(new PrintText("world", Command::LOW_PRIORITY));
	} catch(Queue::Exception &e) {
		std::cout << e.msg << std::endl;
	}

	Globals::queue->execQueue();
	Globals::clear();
	return 0;
}
